package com.itheima.controller;

import com.itheima.common.entity.Result;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/setmeal")
public class SetmealController {

    @Autowired
    private SetmealService setmealService;

    /**
     * 获取所有套餐信息
     * @return
     */
    @PostMapping("/getSetmeal")
    public Result getSetmeal() {
        List<Setmeal> list = setmealService.getSetmeal();
        return new Result(true, "查询成功", list);
    }


    //根据套餐id查询套餐详情，包含（套餐基本信息、套餐关联的检查组、检查组关联的检查项）
    @PostMapping("/findById")
    public Result findById(String id) {
        Setmeal setmeal = setmealService.findById(id);
        return new Result(true, "查询成功", setmeal);
    }

}
